import type {baseResponse, listResponse, paramsType} from "@/api/index";
import {useAxios} from "@/api/index";
export type logTypeType = 1 | 2
export interface logType {
    "id": number
    "createdAt": string
    "ip": string
    "addr": string
    "userID": number
    "title": string,
    "content": string
    "level": number
    "isRead": boolean
    "logType": logTypeType // 日志类型 1 操作日志 2 运行日志
    "userNickname": string
    "userAvatar": string
}

export interface logListParamsType extends paramsType {
    logType: logTypeType
}

export function logListApi(params?: logListParamsType): Promise<baseResponse<listResponse<logType>>> {
    return useAxios.get("/api/logs", {params})
}

export function logReadApi(id: number): Promise<baseResponse<string>> {
    return useAxios.get("/api/logs/" + id.toString())
}